#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int main()
{
	int arr[] = { 4,5,1,6,2,7,3,8 };
	int k = 0;
	int i = 0;
	int j = 0;
	int sz = sizeof(arr) / sizeof(arr[0]);
	int tmp = 0;
	scanf("%d", &k);
	for (i = 0; i < sz - 1; i++)
	{
		for (j = 0; j < sz - 1 - i; j++)
		{
			if (arr[j] > arr[j + 1])
			{
				tmp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = tmp;
			}
		}
	}

	for (i = 0; i < k; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}